import java.util.Objects;

public class Bank {
    String userName;
    String passWord;
    double balance;
    double trade;

    public Bank() {
    }

    public Bank(String userName, String passWord) {
        this.userName = userName;
        this.passWord = passWord;
    }

    public void save(double trade){
        this.balance += trade;
        System.out.println("存款成功,账户余额是：" + this.balance);
    }

    public void draw(String password,double trade){
        if(Objects.equals(this.passWord, password)){
            if(this.balance > trade){
                this.balance -= trade;
                System.out.println("取款成功,账户余额是：" + this.balance);
            }else {
                System.out.println("取款失败，余额小于取款金额账户余额是：" + this.balance);
            }
        }else {
            System.out.println("密码错误");
        }
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getTrade() {
        return trade;
    }

    public void setTrade(double trade) {
        this.trade = trade;
    }
}
